//向下渲染
function type1(data,userid){
	var str = '';
	if(data.forms.id==userid){
			str = '<div class="rightnews">'+
											'<div><img  src="'+data.forms.touxiang+'" /></div>'+
												'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
														'<div>'+data.texts+'</div>'+
														'<div>'+data.create_time+'</div>'+
												'</div>'+
											'</div>';
	}else{
			str = '<div class="leftnews">'+
												'<div><img  src="'+data.forms.touxiang+'" /></div>'+
												'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
														'<div>'+data.texts+'</div>'+
														'<div>'+data.create_time+'</div>'+
												'</div>'+
											'</div>';
	}
	$("#texts").val('');
	$("#msg-list").append(str);
}
function type3(data,userid){
	var str = '';
	if(data.forms.id==userid){
			str = '<div class="rightnews">'+
						'<div><img  src="'+data.forms.touxiang+'" /></div>'+
					'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
					        '<div class="mList"><div class="recordItem" href="java"  src="'+data.yuying+'">'+data.yuyin_time+'  s音频</div></div>'+
							'<div>'+data.create_time+'</div>'+
					'</div>'+
				'</div>';
	}else{
			str = '<div class="leftnews">'+
					'<div><img  src="'+data.forms.touxiang+'" /></div>'+
						'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
						        '<div class="mList"><div class="recordItem" href="java"  src="'+data.yuying+'">'+data.yuyin_time+'  s音频</div></div>'+
								'<div>'+data.create_time+'</div>'+
						'</div>'+
					'</div>';
	}
	$("#msg-list").append(str);
}
function type2(data,userid){
	var str = '';
	if(data.forms.id==userid){
			str = '<div class="rightnews">'+
					'<div><img  src="'+data.forms.touxiang+'" /></div>'+
					'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
							'<div ><img   class="liaoimg" src="'+data.tupians+'" /></div>'+
					'<div>'+data.create_time+'</div>'+
					'</div>'+
				'</div>';
	}else{
			str = '<div class="leftnews">'+
					'<div><img  src="'+data.forms.touxiang+'" /></div>'+
					'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
							'<div ><img   class="liaoimg" src="'+data.tupians+'" /></div>'+
					'<div>'+data.create_time+'</div>'+
					'</div>'+
				'</div>';
	}
	$("#msg-list").append(str);
}
function type4(data,userid){
	var str = '<div class="leftnewsddd">'+
				'<div class="lefttis">'+
               '<span>'+data.forms.name+'</span><span>送给</span><span>'+data.tos.name+'</span>'+
				'<img  class="liaoimg" src="'+data.liwu.tubiao+'" /><span>x1</span>'+
				'</div>'+
				'<div class="lefttiss">'+data.create_time+'</div>'+
			'</div>';
$("#msg-list").append(str);
}

//渲染礼物
function jiazailiwu(data){
	var str = '';
	mui.each(data,function(i,v){
		if(i%8==0){
			str+='<div class="mui-slider-item">'+
								'<div data-id="'+v.id+'" data-icon="'+v.myvalue+'" class="liwu_slider">'+
										'<div class="slider_one">'+
											'<img src="'+v.tubiao+'" alt="">'+
										'</div>'+
										'<div class="slider_two">'+
											'<p>'+v.name+'</p>'+
										'</div>'+
										'<div class="slider_three">'+
											'<img src="../image/jingbi.png" alt="">'+
											'<span>'+v.myvalue+'</span>'+
										'</div>'+
								'</div>';
		}else if(i%8>0&&i%8<7){
			str+='<div data-id="'+v.id+'" data-icon="'+v.myvalue+'" class="liwu_slider">'+
										'<div class="slider_one">'+
											'<img src="'+v.tubiao+'" alt="">'+
										'</div>'+
										'<div class="slider_two">'+
											'<p>'+v.name+'</p>'+
										'</div>'+
										'<div class="slider_three">'+
											'<img src="../image/jingbi.png" alt="">'+
											'<span>'+v.myvalue+'</span>'+
										'</div>'+
								'</div>';
		}else if(i%8==7){
			str+='<div data-id="'+v.id+'" data-icon="'+v.myvalue+'" class="liwu_slider">'+
										'<div class="slider_one">'+
											'<img src="'+v.tubiao+'" alt="">'+
										'</div>'+
										'<div class="slider_two">'+
											'<p>'+v.name+'</p>'+
										'</div>'+
										'<div class="slider_three">'+
											'<img src="../image/jingbi.png" alt="">'+
											'<span>'+v.myvalue+'</span>'+
										'</div>'+
								'</div>'+
						'</div>';
		}
	})
	if((data.length)%8!=7){
		str+='</div>';
	}
	$("#myliwu").empty();
	$("#myliwu").append(str);
	var number = Math.ceil((data.length)/8);
	str = '';
	for(var a=0;a<number;a++){
		if(a==0){
			str+='<div class="mui-indicator mui-active"></div>';
		}else{
			str+='<div class="mui-indicator"></div>';
		}
	}
	$("#liwudiandian").empty();
	$("#liwudiandian").append(str);
	var slider = mui('.mui-slider')
	slider.slider({
	});
}
//向上渲染
function uptype1(data,userid){
	var str = '';
	if(data.forms.id==userid){
			str = '<div class="rightnews">'+
											'<div><img  src="'+data.forms.touxiang+'" /></div>'+
												'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
														'<div>'+data.texts+'</div>'+
														'<div>'+data.create_time+'</div>'+
												'</div>'+
											'</div>';
	}else{
			str = '<div class="leftnews">'+
												'<div><img  src="'+data.forms.touxiang+'" /></div>'+
												'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
														'<div>'+data.texts+'</div>'+
														'<div>'+data.create_time+'</div>'+
												'</div>'+
											'</div>';
	}
	$(".history").after(str);
}
function uptype2(data,userid){
	var str = '';
	if(data.forms.id==userid){
			str = '<div class="rightnews">'+
					'<div><img  src="'+data.forms.touxiang+'" /></div>'+
					'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
							'<div ><img   class="liaoimg" src="'+data.tupians+'" /></div>'+
					'<div>'+data.create_time+'</div>'+
					'</div>'+
				'</div>';
	}else{
			str = '<div class="leftnews">'+
					'<div><img  src="'+data.forms.touxiang+'" /></div>'+
					'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
							'<div ><img   class="liaoimg" src="'+data.tupians+'" /></div>'+
					'<div>'+data.create_time+'</div>'+
					'</div>'+
				'</div>';
	}
	$(".history").after(str);
}
function uptype3(data,userid){
	var str = '';
	if(data.forms.id==userid){
			str = '<div class="rightnews">'+
						'<div><img  src="'+data.forms.touxiang+'" /></div>'+
					'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
					        '<div class="mList"><div class="recordItem" href="java"  src="'+data.yuying+'">'+data.yuyin_time+'  s音频</div></div>'+
							'<div>'+data.create_time+'</div>'+
					'</div>'+
				'</div>';
	}else{
			str = '<div class="leftnews">'+
					'<div><img  src="'+data.forms.touxiang+'" /></div>'+
						'<div class="pingluns">   <div>'+data.forms.name+'</div>'+
						        '<div class="mList"><div class="recordItem" href="java"  src="'+data.yuying+'">'+data.yuyin_time+'  s音频</div></div>'+
								'<div>'+data.create_time+'</div>'+
						'</div>'+
					'</div>';
	}
	$(".history").after(str);
}
function uptype4(data,userid){
	var str = '<div class="leftnewsddd">'+
					'<div class="lefttis">'+
	               '<span>'+data.forms.name+'</span><span>送给</span><span>'+data.tos.name+'</span>'+
					'<img  class="liaoimg" src="'+data.liwu.tubiao+'" /><span>x1</span>'+
					'</div>'+
					'<div class="lefttiss">'+data.create_time+'</div>'+
				'</div>';
	$(".history").after(str);
}